using System;
using System.ComponentModel;
using System.Data;
using System.Runtime.InteropServices;

namespace MediaPlayerToolBar
{
	/// <summary>
	/// Summary description for MP.
	/// </summary>
	public class MP
	{
		private System.Int32 iHandle;
		public MP()
		{
			iHandle = Win32.FindWindow("WMPlayerApp", "Windows Media Player"); 
		}
		public void Stop()
		{
			Win32.SendMessage(iHandle, Win32.WM_COMMAND, 0x00004979, 0x00000000);
		}
		public void PlayPause()
		{
			Win32.SendMessage(iHandle, Win32.WM_COMMAND, 0x00004978, 0x00000000);
		}
		public void Next()
		{
			Win32.SendMessage(iHandle, Win32.WM_COMMAND, 0x0000497A, 0x00000000);
		}
		public void Last()
		{
			Win32.SendMessage(iHandle, Win32.WM_COMMAND, 0x0000497B, 0x00000000);
		}
		public void Mute()
		{
			Win32.SendMessage(iHandle, Win32.WM_COMMAND, 0x00004981, 0x00000000);
		}
		public void VolumeIncrease()
		{
			Win32.SendMessage(iHandle, Win32.WM_COMMAND, 0x0000497F, 0x00000000);
		}
		public void VolumeDecrease()
		{
			Win32.SendMessage(iHandle, Win32.WM_COMMAND, 0x00004980, 0x00000000);
		}
		public void UserAction(int action)
		{
			Win32.SendMessage(iHandle, Win32.WM_COMMAND, action, 0x00000000);
		}
	}
}
